package org.amse.Archiver.algorithm.huffman;
public class Node {
    private Node myLeft;
    private Node myRight;
    private Node myParent;
    private final int myStatistic;
    private final int myIndex;
	private final int mySymCode;
	private boolean myUsed = false;
	
    public Node(int statistic, int symCode, int index) {
        myStatistic = statistic;
	    mySymCode = symCode;
		myIndex = index;
    }
	
	public Node(Node left, Node right, int index) {
	    myLeft = left;
		myRight = right;
		myStatistic = left.getStatistic() + right.getStatistic();
		mySymCode = -1;
		myIndex = index;
	}
	
	public void setParent(Node n) {
	    myParent = n;
	}
	
	public void use() {
	   myUsed = true;
	}
	
	public boolean getUsed () {
	    return myUsed;
	}
	
	public final Node getLeft() {
	    return myLeft;
	} 
	
	public final Node getRight() {
	    return myRight;
	}
	
	public final Node getParent() {
	    return myParent;
	}
	
	public final int getStatistic() {
	    return myStatistic;
	}
	
	public final int getCodeSym() {
	    return mySymCode;
	}
	
	public final int getIndex() {
	    return myIndex;
	}
}